package com.atguigu.lease.common.springmvc;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

@Data
public class leaseException extends RuntimeException{
    private int code;

    /**
     * Constructs a new runtime exception with the specified detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     *
     * @param message the detail message. The detail message is saved for
     *                later retrieval by the {@link #getMessage()} method.
     */
    public leaseException(String message, int code) {
        super(message);
        this.code = code;
    }
    public leaseException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
